#include "gdbinfo.h"


void print_info(const char *format, ...) {
    time_t rawtime;
    struct tm *timeinfo;
    char buffer[80];

    time(&rawtime);
    timeinfo = localtime(&rawtime);

    strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", timeinfo);
    printf("%s  ", buffer);

    va_list args;
    va_start(args, format);
    vprintf(format, args);
    va_end(args);
    printf("\n");
}

void ip_to_str(uint8_t *my_ip, char *dest, int size) {
    if(size==4){
        sprintf(dest, "%d.%d.%d.%d", my_ip[0],my_ip[1],my_ip[2],my_ip[3]);
    }
    else if(size==6){
        sprintf(dest, "%d.%d.%d.%d.%d.%d", my_ip[0],my_ip[1],my_ip[2],my_ip[3],my_ip[4],my_ip[5]);
    }
    
}